package config

import (
	"io/ioutil"
	appV1 "k8s.io/api/apps/v1"
	coreV1 "k8s.io/api/core/v1"
	"log"
	"os"
	"sigs.k8s.io/yaml"
	"strings"
)

var ByySvc = new(coreV1.Service)
var ByyDeploy = new(appV1.Deployment)

func init() {
	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(err.Error())
	}
	y, err := ioutil.ReadFile(dir + "/byy-app.yaml")
	if err != nil {
		log.Fatal(err.Error())
	}

	s := string(y)
	ss := strings.Split(s, "---")

	yaml.Unmarshal([]byte(ss[0]), &ByySvc)
	yaml.Unmarshal([]byte(ss[1]), &ByyDeploy)

}
